import Vue from 'vue'
import Router from 'vue-router'

const Login = (resolve) => { //登录页面
  import('page/login/login').then((Login) => {
    resolve(Login)
  })
}
const Auth = (resolve) => { //用户认证
  import('page/login/auth').then((Auth) => {
    resolve(Auth)
  })
}

const SpecialtyRelease = (resolve) => { //土特产发布页面
  import('page/localSpecialty/release').then((SpecialtyRelease) => {
    resolve(SpecialtyRelease)
  })
}
const SpecialtyList = (resolve) => { //土特产发布列表
  import('page/localSpecialty/list').then((SpecialtyList) => {
    resolve(SpecialtyList)
  })
}
const SpecialtyDetails = (resolve) => { //土特产详情页
  import('page/localSpecialty/details').then((SpecialtyDetails) => {
    resolve(SpecialtyDetails)
  })
}
const Address = (resolve) => { //土特产详情页
  import('components/address/select').then((Address) => {
    resolve(Address)
  })
}
const Complaint = (resolve) => { //投诉
  import('components/complaint/complaint').then((Complaint) => {
    resolve(Complaint)
  })
}
const BaiduMap = (resolve) => { //百度地图位置
  import('components/baiduMap/baiduMap').then((BaiduMap) => {
    resolve(BaiduMap)
  })
}

Vue.use(Router)
export default new Router({
  mode: 'history',
  routes: [
    {path: '/login', component: Login, meta: {keepAlive: false}},//登录页面
    {path: '/login/:id', component: Login, meta: {keepAlive: false}},//带参数过来的登录页面
    {path: '/auth', component: Auth, meta: {keepAlive: false}},//认证页面
    {path: '/auth/:id', component: Auth, meta: {keepAlive: false}},//带参数过来的认证页面
    {path: '/specialtyRelease', component: SpecialtyRelease, meta: {keepAlive: false}},//土特产发布页面
    {path: '/specialtyList/:sid', component: SpecialtyList, meta: {keepAlive: false}},//土特产发布列表
    {path: '/specialtyDetails/:id', component: SpecialtyDetails, meta: {keepAlive: false}},//土特产详情页
    {path: '/address/:id', component: Address, meta: {keepAlive: false}},//地址
    {path: '/complaint/:id', component: Complaint, meta: {keepAlive: false}},//投诉
    {path: '/baiduMap/:lng/:lat/:site', component: BaiduMap, meta: {keepAlive: false}},//百度地图
  ]
})
